import { IPSDEFVRSysValueRuleCondition } from './ipsdefvrsys-value-rule-condition';
import { PSDEFVRSingleConditionImpl } from './psdefvrsingle-condition-impl';
import { IPSSysValueRule } from '../../../valuerule/ipssys-value-rule';

export class PSDEFVRSysValueRuleConditionImpl extends PSDEFVRSingleConditionImpl implements IPSDEFVRSysValueRuleCondition {
  protected pssysvaluerule: IPSSysValueRule | null = null;

  getPSSysValueRule(): IPSSysValueRule | null {
    if (this.pssysvaluerule != null) return this.pssysvaluerule;
    const value = this.M.getPSSysValueRule;
    if (value == null) {
      return null;
    }
    this.pssysvaluerule = this.getPSModel4('valuerule.IPSSysValueRule', value, 'getPSSysValueRule') as IPSSysValueRule;
    return this.pssysvaluerule;
  }

  get psSysValueRule(): IPSSysValueRule | null {
    return this.getPSSysValueRule();
  }

  getPSSysValueRuleMust(): IPSSysValueRule {
    const value = this.getPSSysValueRule();
    if (value == null) {
      throw new Error('未指定系统值规则对象');
    }
    return value;
  }

  get ruleInfo(): string {
    return this.M.ruleInfo;
  }

  get cls(): string {
    return 'PSDEFVRSysValueRuleConditionImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.defield.valuerule.IPSDEFVRSysValueRuleCondition') return true;
    return super.instanceof(cls);
  }
}
